#include "dialogbase.h"
#include <QMouseEvent>
#include <QRect>
#include <QPainter>
#include <QTimer>
#include <QGraphicsDropShadowEffect>

DialogBase::DialogBase(QWidget *parent) : QWidget(parent)
{
    //this->setStyleSheet("background-color: white;");
    this->setAttribute(Qt::WA_TranslucentBackground);
    this->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
    this->setAttribute(Qt::WA_DeleteOnClose);
}

void DialogBase::paintEvent(QPaintEvent *event)
{
    QWidget::paintEvent(event); // 保持正常绘制

    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);

    QPen pen(QColor("#CCCCCC"));
    pen.setWidth(1);
    painter.setPen(pen);
    painter.setBrush(Qt::white);

    QRect rect = this->rect().adjusted(1, 1, -1, -1); // 稍微缩小1像素
    painter.drawRoundedRect(rect, 10, 10);
}
